package com.arges.util;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

/**
 * Hibernate 工具类
 */
public class HibernateUtils {

    public static SessionFactory sessionFactory;

    static {
        Configuration configure = new Configuration().configure();
        sessionFactory = configure.buildSessionFactory();

    }

    /**
     * 获取Session
     * @return
     */
    public static Session getSession(){
        Session session = sessionFactory.openSession();
        return session;
    }
}
